﻿using _1_Interfaces.Interfaces.Cjw;
using _1_Interfaces.Models.Dtos.Cjw;
using _1_Interfaces.Models.Tables.Cjw;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace _3_Controllers.Controllers.Cjw
{
    /// <summary>
    /// 科室病床表服务
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CjwSickBedListController : ControllerBase
    {
        private ISickBedListService _sickBedListService;
        public CjwSickBedListController(ISickBedListService sickBedListService)
        {
            _sickBedListService = sickBedListService;
        }
        /// <summary>
        /// 获取病床列表
        /// </summary>
        /// <param name="sickBedListDto"></param>
        /// <returns></returns>
        [HttpPost]
        public SickBedListOutDto GetSickBedList(SickBedListDto sickBedListDto)
        {
            return _sickBedListService.GetSickBedList(sickBedListDto);
        }

        /// <summary>
        /// 新增病床
        /// </summary>
        /// <param name="sickBedListAddDto"></param>
        /// <returns></returns>
        [HttpPost]
        public bool InsertSickBed(SickBedListAddDto sickBedListAddDto)
        {
            return _sickBedListService.InsertSickBed(sickBedListAddDto);
        }

        /// <summary>
        /// 修改病床
        /// </summary>
        /// <param name="sickBedList"></param>
        /// <returns></returns>
        [HttpPost]
        public bool UpdateSickBed(SickBedList sickBedList)
        {
            return _sickBedListService.UpdateSickBed(sickBedList);
        }

        /// <summary>
        /// 病床状态修改
        /// </summary>
        /// <param name="sickBedListStateDto"></param>
        /// <returns></returns>
        [HttpPost]
        public bool UpdateBedState(SickBedListStateDto sickBedListStateDto)
        {
            return _sickBedListService.UpdateBedState(sickBedListStateDto);
        }

        /// <summary>
        /// 删除病床
        /// </summary>
        /// <param name="sickBedIds"></param>
        /// <returns></returns>
        [HttpPost]
        public bool DeleteSickBed(List<int> sickBedIds)
        {
            return _sickBedListService.DeleteSickBed(sickBedIds);
        }

        /// <summary>
        /// 小程序端的亲戚查询病床
        /// </summary>
        /// <param name="patientName">病人姓名</param>
        /// <param name="phoneNumber">病人电话号码</param>
        /// <returns></returns>
        [HttpGet]
        public SickBedAppSearchDto AppSearch(string patientName, string phoneNumber)
        {
            return _sickBedListService.AppSearch(patientName, phoneNumber);
        }
    }
}
